<template>
  <div class="modify-dialog">
    <slot> </slot>
    <el-dialog v-bind="dialogOpts" :visible.sync="dialogVisible">
      <Form v-bind="formOpts" v-on="formEvent">
        <template #formBtn>
          <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="onConfirm"> 确 定 </el-button>
          </div>
        </template>
      </Form>
    </el-dialog>
  </div>
</template>

<script>
import modifyMixins from "@/mixins/modifyMixins.vue";

export default {
  mixins: [modifyMixins],
  data() {
    return {
      labelPosition: "left",
      form: {
        area: {
          tag: "el-select",
          label: "省份",
          value: "",
          items: [],
          props: {
            clearable: true,
            filterable: true,
          },
        },
      },
    };
  },
  computed: {
    title() {
      return "发给仓库";
    },
  },
  methods: {
    onSubmit(form) {
      const { modify, row, fileList, fileList2 } = this;
      form.id = row.id;
      this.$api["newOrderUpdate"](form).then(this.submitDoneMsg);
    },
    showDialog(modify = "add", row = {}) {
      this.dialogVisible = true;
      this.row = row;
      const map = this.$store.state.areaMap;
      this.form.area.items = Object.keys(map).map((value) => ({
        value,
        label: map[value],
      }));
    },
  },
};
</script>

<style lang="less" scoped></style>
